package com.guonan.lambda.cart;

import java.util.ArrayList;
import java.util.List;

public class CartService {


    private static List<Sku> cartSkuList = new ArrayList<Sku>() {
        {
            add(new Sku(65432, "无人机" ,
                    4999.00, 1,
                    4999.00, CartgoryEnum.ELECTROCITY));
            add(new Sku(65433, "NIKE" ,
                    14999.00, 1,
                    14999.00, CartgoryEnum.SPORTS));
            add(new Sku(65434, "阿玛尼大衣" ,
                    24999.00, 1,
                    24999.00, CartgoryEnum.CLOTHING));
            add(new Sku(65435, "三国志" ,
                    34999.00, 1,
                    34999.00, CartgoryEnum.BOOKS));
            add(new Sku(65435, "篮球" ,
                    999.00, 1,
                    999.00, CartgoryEnum.SPORTS));
            add(new Sku(65435, "APPLE电脑" ,
                    134999.00, 1,
                    134999.00, CartgoryEnum.ELECTROCITY));

        }
    };

    public static List<Sku> getCartSkuList(){
        return cartSkuList;
    }

    public static List<Sku> filterElectrocitySkus(List<Sku> cartSkuList){
        List<Sku> result = new ArrayList<Sku>();
        for(Sku sku : cartSkuList){
            if(CartgoryEnum.ELECTROCITY.
                    equals(sku.getSkuCategory())){
                result.add(sku);
            }
        }
        return result;
    }

}
